/*
 *  glue.h
 *  EPPI-0.0
 *
 *  Created by Juan Carlos Garcia Orden on 05/02/09.
 *
 */
 
#ifndef _glue_h_
#define _glue_h_

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include "mecsystem.h"
#include "BODIES/body.h"
#include "point.h"

class MecSystem;

using namespace std;

class GGlue : public Joint
{
public:
	string pointName;
	vector< vector<string> > pNames;	/** Points of first body in first row. Second in second */
	double tolerance;
/*	Data members from the base class Joint
	string name;
	int dim;	
	MecSystem* parentSystem;				
	vector<Component*> vComponents;
	vector<Component*> vLoads;
 	string outGraphFilex;
	vector<string> vPointNamesSurface;
	vector<Point*> vPPointSurface;
	ofstream localFGraph;
*/

public:
	GGlue(){}
	GGlue(ifstream &, string, MecSystem*);
	~GGlue(){}
	
	/** Virtual functions from base */
//	void setPTPointsComp();		/** Set pointers to points in each component */
//	void setPTPointsLoad();		/** Set pointers to points in each load */
	void setPTPointsCons();		/** Set pointers to points in each constraint */
//	void setPTPoints();			/** Set pointers to the points of the body, based on the list of point names */
//	void setPTBodies();			/** Set pointers to the bodies, based on the list of body names */
	void setPPointSurface();	/** Set pointers to surface points in each component */
//	void writeFileGraph(ofstream&,string&);	/** Write graphical output to file */
	void writeMSH(ofstream&);		/** MSH format for Gmsh */
	void writeVTU(ofstream&);		/** VTU format for Paraview */
	void writeOOGL(ofstream&);	/** OOGL format for Geomview */
//	void writeFileTemp(const double&, ofstream &);
//	void setIniPosJoint(vector<double>&);
	
	/** Local functions */
	void searchSharedPoints(vector<string>&);
	void searchSharedPointsPSets(vector<string>&);
	
	/** Friend functions */
	friend double lTwoNorm(const vector<double>& v1, const vector<double>& v2);
	
};

#endif
